///******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/

#define TRACE() uart_print("%s %d\n", __FUNCTION__, __FILE__)
#define DEBUG(fmt, args...) uart_print(fmt, ##args)

 #ifndef CONFIG_STM32G_MAINTAIN
#include <stm32f10x.h>
#include <stm32f10x_gpio.h>
#include <stm32f10x_rcc.h>
#include <stm32f10x_usart.h>
#include <uart.h>

void RCC_Configuration(void);

void GPIO_Configuration(void);
int c = 20;
int main(void)
{
		RCC_Configuration();
		GPIO_Configuration();
		uart_open (USART1, 9600, 0);
		uart_print("\n Hello world! \r\n");
	  DEBUG("My name is thien\n");
		while (1)
		{ 
/*			while (c<200)
			{
				uart_putc(c, USART1);
				c++;
			}
*/			
		}
}


void RCC_Configuration(void)
{
		RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
		RCC_APB2PeriphClockCmd ( RCC_APB2Periph_USART1 |
			RCC_APB2Periph_AFIO |
			RCC_APB2Periph_GPIOA , ENABLE );
}

void GPIO_Configuration(void)
{
//	GPIO_InitTypeDef GPIO_InitStructure;
//	
//	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
//	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
//	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//	
//	GPIO_Init(GPIOA, &GPIO_InitStructure);
}
#else
#include <stm32f10x.h>
#include <stm32f10x_gpio.h>
#include <stm32f10x_rcc.h>
#include <stm32f10x_usart.h>
#include <uart.h>

void RCC_Configuration(void)
{
		RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
		RCC_APB2PeriphClockCmd ( RCC_APB2Periph_USART1 |
			RCC_APB2Periph_AFIO |
			RCC_APB2Periph_GPIOA , ENABLE );
}

extern int vbb_main(void);

int main(void)
{
		RCC_Configuration();	
		uart_open (USART1, 9600, 0);
	  DEBUG("_________Taxi Porting___________\n");
	  DEBUG("Booting hardware	\n");
	  
	  vbb_main();
    while(1)
    {
		
		}	
		
}	
#endif
